package com.xiaohudie.Jedis;

/**
 * @Author xiao hu die
 * @Date 2022/2/28 19:45
 * @Version 1.0
 */

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**JEDIS连接池*/
public class JedisConnectionFactory {
    private static  final JedisPool jedispool ;
static {
    /**配置连接池*/
    JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
    /**最大连接数量*/
    jedisPoolConfig.setMaxTotal(8);
    /**最大空闲连接数*/
    jedisPoolConfig.setMaxIdle(8);
    /**最小空闲连接数*/
    jedisPoolConfig.setMinIdle(0);
    /**设置最小等待时间*/
    jedisPoolConfig.setMaxWaitMillis(1000);
    jedispool = new JedisPool(jedisPoolConfig, "112.124.39.228", 6379, 1000);
}
/**获取jedis对象*/
public static Jedis getJedis(){
    return jedispool.getResource();
}
}
